home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pyr_tombdoor.cog < prev    next >
Text File  |  1999-11-15  |  5KB  |  224 lines

  1. # Jones 3D Cog Script
  2. #
  3. # pyr_tombdoor.cog
  4. #
  5. # Push open the tomb doors in pyramid 2
  6. #
  7. # [RKD & revised by HB]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. # ==============================================================================
  11.  
  12. symbols
  13. message    activated
  14. message    arrived
  15. message    startup
  16. message    pulse
  17.  
  18. # world things
  19. thing    door
  20. thing    plunker        nolink
  21. thing    player        local
  22.  
  23. # cameras and lookthings
  24. thing    goodcam        nolink
  25. thing    goodcamlook    nolink
  26. thing    badcam        nolink
  27. thing    cam1spot    local
  28. thing    cam1look    local
  29.  
  30. # sector player should be in for a good shove
  31. sector    pushsector    nolink
  32.  
  33. # keyframes
  34. keyframe    indypush=0in_passport_1_1.key    local
  35.  
  36. # indy sayline
  37. sound    thisside=inxj102.wav        local
  38. sound    snakes=Inxj070.wav            local # Oh no! Snakes!
  39.  
  40. # sound
  41. sound    crunch=pru_trapblock_stuck_c.wav    local
  42.  
  43. # variables
  44. flex    speed=0.4         local
  45. flex    distance=0        local
  46. int        locked=0        local
  47. int        counter=8        local
  48. int        direction=0
  49.  
  50. # subroutines
  51. flex    opendoor=0.0    local
  52. end
  53.  
  54. # ========================================================================================
  55.  
  56. # Code Section
  57. code
  58. startup:
  59.     SetThingLight(door, '.2 .2 .1', .001, .01);
  60.     SetSectorAdjoins(GetThingSector(door), 0);
  61.     return;
  62.  
  63. activated:
  64. # ---> door    
  65.  
  66.     if (locked) return;
  67.     
  68.     player = GetLocalPlayerThing();
  69.     
  70.     if (MakeMeStop() == -1) return;
  71.     DeselectWeaponWait(player);
  72.     
  73.     SetSectorAdjoins(GetThingSector(door), 1);
  74.     
  75.     locked = 1;    
  76.     StartCutscene(0);
  77.     
  78.     #if player is inside the crypt, open the door
  79.     if (GetThingSector(player) == pushsector)
  80.     {
  81.         SetActorFlags(player, 0x200000);
  82.         
  83.         # setup offset camera
  84.         cam1spot = CreateThing(GetThingTemplate(goodcam), goodcam);
  85.         cam1look = CreateThing(GetThingTemplate(goodcam), goodcam);
  86.         MakeCamera2LikeCamera1(cam1spot, cam1look);
  87.         SetCameraLookInterp(2, 0);
  88.         SetCameraPosInterp(2, 0);
  89.         SetCameraFocus(2, cam1spot);
  90.         SetCameraSecondaryFocus(2, cam1look);
  91.         SetCurrentCamera(2);
  92.         ResetCameraFOV(0, 0.0);
  93.         SetCameraLookInterp(2, 1);
  94.         SetCameraPosInterp(2, 1);
  95.         SetCameraInterpSpeed(2, 0.7);
  96.         Sleep(0.01);
  97.         SetCameraFocus(2, goodcam);
  98.         SetCameraSecondaryFocus(2, goodcamlook);
  99.  
  100.         sleep(.3);
  101.     
  102.         PlayMode(player, 61, 0);
  103.  
  104.         sleep(.4);
  105.         
  106.         SetCollideType(door, 0);
  107.         call opendoor;
  108.     }
  109.     else
  110.     #otherwise, sayline
  111.     {
  112.         SetActorFlags(player, 0x200000);
  113.  
  114.         # setup offset camera
  115.         cam1spot = CreateThing(GetThingTemplate(badcam), badcam);
  116.         cam1look = CreateThing(GetThingTemplate(badcam), badcam);
  117.         MakeCamera2LikeCamera1(cam1spot, cam1look);
  118.         SetCameraLookInterp(2, 0);
  119.         SetCameraPosInterp(2, 0);
  120.         SetCameraFocus(2, cam1spot);
  121.         SetCameraSecondaryFocus(2, cam1look);
  122.         SetCurrentCamera(2);
  123.         ResetCameraFOV(0, 0.0);
  124.         SetCameraLookInterp(2, 1);
  125.         SetCameraPosInterp(2, 1);
  126.         SetCameraInterpSpeed(2, 0.7);
  127.         Sleep(0.01);
  128.         SetCameraFocus(2, badcam);
  129.         SetCameraSecondaryFocus(2, door);
  130.  
  131.         sleep(.3);
  132.         PlayMode(player, 61, 1);
  133.         PlayVoice(player, thisside, 1, 1);
  134.         Sleep(.5);
  135.  
  136.         # restore camera and get rid of objects
  137.         SetCameraLookInterp(2, 0);
  138.         SetCameraPosInterp(2, 0);
  139.         SetCameraPosition(1, GetThingPos(badcam));
  140.         SetCurrentCamera(1);
  141.         DestroyThing(cam1spot);
  142.         DestroyThing(cam1look);
  143.         
  144.         locked = 0;
  145.         
  146.         ClearActorFlags(player, 0x200000);
  147.         EndCutscene();
  148.     }
  149.  
  150.     return;
  151.  
  152. arrived:
  153. # ---> door
  154.     
  155.     #door still falling, speed it up and increment distance
  156.     speed = speed * .5;
  157.     distance = distance + 10;
  158.     call opendoor;
  159.     return;
  160.     
  161. opendoor:
  162.     #if fully fallen, move the door out
  163.     if (distance > 100)
  164.     {
  165.         AttachThingToThing(door, plunker);
  166.         MoveToFrame(plunker, 1, 5);
  167.         PlaySoundThing(crunch, door, 1.0, -1, -1, 0);
  168.         SetPulse(.1);
  169.  
  170.         sleep(1);
  171.         
  172.         # if it's the north-south crypt, play snake line
  173.         if (direction == 0)
  174.         {
  175.             PlayVoice(player, snakes, 1, 0);
  176.             sleep(1);
  177.             PlayKey(player, indypush, 4, 0x12, 0);
  178.             sleep(2);
  179.         }
  180.  
  181.         sleep(.5);
  182.         
  183.         # restore camera and get rid of objects
  184.         SetCameraLookInterp(2, 0);
  185.         SetCameraPosInterp(2, 0);
  186.         SetCameraPosition(1, GetThingPos(goodcam));
  187.         SetCurrentCamera(1);
  188.         DestroyThing(cam1spot);
  189.         DestroyThing(cam1look);
  190.         
  191.         SetCollideType(door, 3);
  192.  
  193.         ClearActorFlags(player, 0x200000);
  194.         EndCutscene();
  195.     }
  196.     else
  197.     #otherwise, keep turning it
  198.     {
  199.         Rotate(door, -10, direction, speed);
  200.     }
  201.     
  202.     return;
  203.  
  204. pulse:
  205.     if (counter > 1)
  206.     {
  207.         counter = counter - 1;
  208.         
  209.         SetPOVShake(VectorScale(VectorSet(RandBetween(-1, 1), RandBetween(-1, 1), RandBetween(-1, 1)), .0002 * counter),
  210.                     VectorScale(VectorSet(RandBetween(-2, 2), RandBetween(-2, 2), RandBetween(-2, 2)), .02 * counter),
  211.                     10, 180);
  212.     }
  213.     else
  214.     {
  215.         SetPulse(0);
  216.     }
  217.  
  218.     return;
  219.     
  220.  
  221. end
  222.  
  223.  
  224.